package com.ys.erp.entity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ys.erp.entity.data.bean.StrongComplaintRecord;
import com.ys.erp.entity.mapper.StrongComplaintRecordMapper;
import com.ys.erp.entity.service.IStrongComplaintRecordService;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author lwj
 * @date 2025/7/24
 */
    
@Service
public class IStrongComplaintRecordServiceImpl extends ServiceImpl<StrongComplaintRecordMapper, StrongComplaintRecord> implements IStrongComplaintRecordService{

    @Override
    public List<StrongComplaintRecord> listByNoList(Collection<String> noList) {
        QueryWrapper<StrongComplaintRecord> recordQw = new QueryWrapper<>();
        recordQw.lambda().in(StrongComplaintRecord::getComplaintNo, noList);
        recordQw.lambda().orderByDesc(StrongComplaintRecord::getRecordTime);
        return this.list(recordQw);
    }

    @Override
    public Map<String, List<StrongComplaintRecord>> mapByNoList(Collection<String> noList) {
        return listByNoList(noList).stream().collect(Collectors.groupingBy(StrongComplaintRecord::getComplaintNo));
    }

}
